The present invention relates to image mapping, and in particular mapping an image expressed in cylindrical coordinates to a rectangular viewing plane.
A good description of prior art rendering techniques can be found in the Chen patent (U.S. Pat. No. 5,396,583), assigned to Apple Computer, Inc. The Chen patent describes a method of mapping an image expressed in cylindrical coordinates to a viewing plane. Chen uses a forward mapping technique to perform a spatial transformation on each input pixel expressed in cylindrical coordinates such that it is expressed in the planar coordinates of the viewing plane. In accordance with this method, a cylindrical environment map is used to express a scene (i.e., the input image data is expressed in cylindrical coordinates). The perspective adjusted projection of the cylindrical data onto the viewing plane is determined by multiplying the input pixel values by scaling factors which adjust for the differences in distance from the center of the cylinder to the input pixel""s location on the cylinder. In other words, the further the pixel is from the center of the viewing plane along the horizontal, the more perspective adjustment is necessary, and the further the pixel is from the vertical center of the cylinder, the more perspective adjustment is necessary.
Movement of the viewing plane around the cylinder is accomplished by performing a two-pass cylindrical to planar projection. Horizontal rotation around the center axis of the cylinder is calculated in the first pass, while vertical rotation up and down the cylinder is calculated in the second pass. In the first pass, the horizontal rotation is accounted for by mapping the cylinder to a vertical plane using scaling factors (rcos(u)/d) stored in a look-up table. These scaling factors provide the horizontal perspective adjustment. Once the horizontal translation and perspective adjustment is calculated and the results stored in a buffer, the vertical rotation is determined by mapping the vertical plane to the rotated viewing plane using a uniform scaling of data for each horizontal scan-line. A different scaling factor is computed for perspective adjustment in the vertical direction by multiplying the y-coordinates of the viewing plane with the v-value stored in a look-up table. In a preferred embodiment, a look-up table for non-uniform vertical increments is computed and used during the first mapping to decide which horizontal scan-lines to create for the vertical plane. This approach creates non-uniformly distributed scan-lines on the vertical plane which map to uniformly distributed scan-lines on the viewing plane as a simple scaling of each horizontal scan-line.
The Chen patent shows a forward mapping technique in which the cylindrical coordinate data is mapped to the viewing plane using a plurality of scaling factors, first for horizontal, and then for vertical displacement. In other words, the input pixel values in cylindrical coordinates are mapped to a translated viewing place with perspective correction performed by calculated scaling factors. Since the vertical displacement is calculated from the horizontally displaced data points, the results of the horizontal displacement are buffered in an intermediate buffer during the first pass and then used during the second pass to map to the vertically displaced viewing plane.
The present invention provides a single-pass method which is an inverse mapping technique that maps an image expressed in cylindrical coordinates to a viewing plane. In accordance with this method, a cylindrical environment map is also used to express a scene. However, rather than projecting the image in cylindrical coordinates out onto the viewing plane, the pixels on the viewing plane are ray-traced, in scan-line order, back through the cylinder to determine the corresponding points of intersection on the cylinder. The intersecting rays form a xe2x80x9cclam-shellxe2x80x9d like sampling region on the cylinder, and the corresponding output pixel values for the points of intersection on the cylinder are copied to the corresponding output pixel. No other perspective adjustment or scaling factors are necessary. Also, no intermediate data buffer is necessary.
Normally, a ray-tracing approach of this type is computationally intensive. However, computations are minimized by mapping the top and bottom borders of the viewing plane to the cylinder to determine the top and bottom arcs of the clam-like shaped sampling region on the cylinder and then, for each pair of values in each array, interpolating vertically to get the rest of the sample points on the cylinder. Additional arcs between the top and bottom arcs of the sampling region may be calculated as desired to minimize projection error.
For a further understanding of the nature and advantages of the invention, reference should be made to the following description taken in conjunction with the accompanying drawings.